<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge" >
  <link rel="dns-prefetch" href="http://yoursite.com">
  <title>Appium-Python iOS自动化测试从0-1 | Sandsyu Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="1.Appium环境搭建参考官网appium.io给出的终端命令进行安装.
&amp;gt; brew install node      //安装node
&amp;gt; npm install -g appium  //安装 appium
&amp;gt; npm install wd         //安装 appium client
&amp;gt; appium &amp;amp;               // 启动">
<meta property="og:type" content="article">
<meta property="og:title" content="Appium-Python iOS自动化测试从0-1">
<meta property="og:url" content="http://yoursite.com/2016/12/20/Appium-Python iOS自动化测试从0-1/index.html">
<meta property="og:site_name" content="Sandsyu Blog">
<meta property="og:description" content="1.Appium环境搭建参考官网appium.io给出的终端命令进行安装.
&amp;gt; brew install node      //安装node
&amp;gt; npm install -g appium  //安装 appium
&amp;gt; npm install wd         //安装 appium client
&amp;gt; appium &amp;amp;               // 启动">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-5.png">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-4.png">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-7.jpeg">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-1.jpeg">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-2.png">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-3.png">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-6.jpeg">
<meta property="og:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-8.png">
<meta property="og:updated_time" content="2016-12-20T06:37:41.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Appium-Python iOS自动化测试从0-1">
<meta name="twitter:description" content="1.Appium环境搭建参考官网appium.io给出的终端命令进行安装.
&amp;gt; brew install node      //安装node
&amp;gt; npm install -g appium  //安装 appium
&amp;gt; npm install wd         //安装 appium client
&amp;gt; appium &amp;amp;               // 启动">
<meta name="twitter:image" content="http://oif61bzoy.bkt.clouddn.com/appium0-1-5.png">
  
    <link rel="alternative" href="/atom.xml" title="Sandsyu Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link rel="stylesheet" href="/main.css?v=4.0.0.css">
  

  

</head>

<body>
  <div id="container" q-class="show:isCtnShow">
    <canvas id="anm-canvas" class="anm-canvas"></canvas>
    <div class="left-col" q-class="show:isShow">
      <div class="overlay"></div>
<div class="intrude-less">
	<header id="header" class="inner">
		<a href="/" class="profilepic">
			<img src="http://oif61bzoy.bkt.clouddn.com/header.png" class="js-avatar">
		</a>

		<hgroup>
		  <h1 class="header-author"><a href="/">Sandsyu</a></h1>
		</hgroup>

		

		<nav class="header-menu">
			<ul>
			
				<li><a href="/">主页</a></li>
	        
				<li><a href="/tags/2016/">2016年</a></li>
	        
			</ul>
		</nav>
		<nav class="header-smart-menu">
	        
    		
    			
    			<a data-idx="0" q-on="click: openSlider(e, 'innerArchive')" href="javascript:void(0)">所有文章</a>
    			
    			
            
    			
    			<a data-idx="1" q-on="click: openSlider(e, 'friends')" href="javascript:void(0)">友链</a>
    			
    			
            
    			
    			<a data-idx="2" q-on="click: openSlider(e, 'aboutme')" href="javascript:void(0)">关于我</a>
    			
    			
            
		</nav>
		<nav class="header-nav">
			<div class="social">
				
					<a class="github" target="_blank" href="https://github.com/yushengchu" title="github"><i class="icon-github"></i></a>
		        
					<a class="zhihu" target="_blank" href="#" title="zhihu"><i class="icon-zhihu"></i></a>
		        
					<a class="qq" target="_blank" href="#" title="qq"><i class="icon-qq"></i></a>
		        
					<a class="mail" target="_blank" href="mailto:yushengchu@aliyun.com" title="mail"><i class="icon-mail"></i></a>
		        
			</div>
		</nav>
	</header>		
</div>

    </div>
    <div class="mid-col" q-class="show:isShow,hide:isShow|isFalse">
      <nav id="mobile-nav">
  	<div class="overlay">
  		<div class="slider-trigger"><i class="icon-sort"></i></div>
  		<h1 class="header-author js-mobile-header hide">Sandsyu</h1>
  	</div>
	<div class="intrude-less">
		<header id="header" class="inner">
			<div class="profilepic">
				<img src="http://oif61bzoy.bkt.clouddn.com/header.png" class="js-avatar">
			</div>
			<hgroup>
			  <h1 class="header-author">Sandsyu</h1>
			</hgroup>
			
			<nav class="header-menu">
				<ul>
				
					<li><a href="/">主页</a></li>
		        
					<li><a href="/tags/2016/">2016年</a></li>
		        
		        
		        	<li><a href="/archives/">所有文章</a></li>
		        
				</ul>
			</nav>
			<nav class="header-nav">
				<div class="social">
					
						<a class="github" target="_blank" href="https://github.com/yushengchu" title="github"><i class="icon-github"></i></a>
			        
						<a class="zhihu" target="_blank" href="#" title="zhihu"><i class="icon-zhihu"></i></a>
			        
						<a class="qq" target="_blank" href="#" title="qq"><i class="icon-qq"></i></a>
			        
						<a class="mail" target="_blank" href="mailto:yushengchu@aliyun.com" title="mail"><i class="icon-mail"></i></a>
			        
				</div>
			</nav>
		</header>				
	</div>
</nav>

      <div id="wrapper" class="body-wrap">
        <div class="menu-l">
          <div class="canvas-wrap">
            <canvas data-colors="#eaeaea" data-sectionHeight="100" data-contentId="js-content" id="myCanvas1" class="anm-canvas"></canvas>
          </div>
          <div id="js-content" class="content-ll">
            <article id="post-Appium-Python iOS自动化测试从0-1" class="article article-type-post " itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Appium-Python iOS自动化测试从0-1
    </h1>
  

        <a href="/2016/12/20/Appium-Python iOS自动化测试从0-1/" class="archive-article-date">
  	<time datetime="2016-12-20T02:39:00.000Z" itemprop="datePublished"><i class="icon-calendar icon"></i>2016-12-20</time>
</a>
      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p><strong>1.Appium环境搭建</strong><br>参考官网appium.io给出的终端命令进行安装.</p>
<pre><code>&gt; brew install node      //安装node
&gt; npm install -g appium  //安装 appium
&gt; npm install wd         //安装 appium client
&gt; appium &amp;               // 启动 appium
&gt; node your-appium-test.js //执行脚本
</code></pre><p>以上安装的是终端版的appium,再安装一个图形界面的appium方便查看界面元素.<br><a id="more"></a><br><strong>2.测试包编译 appium参数设置</strong><br>　　2.1测试包编译:<br>　　　　1.跟开发要.app后缀的测试包<br>　　　　2.本地搭建iOS开发环境 使用xcodebuilder命令编译<br>　　　　<code>xcodebuild -sdk iphonesimulator -target YouProject</code></p>
<p>　　２.２参数设置<br>　　　　图形界面:<br>　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-5.png" alt=""><br>　　　　　　点击选择平台,跳出设置参数界面,选择好运行设备,版本号,测试app的路径点击放大镜图标运行.<br>　　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-4.png" alt=""><br>　　　　　　成功运行后会弹出模拟器并自动运行测试项目．<br>　　　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-7.jpeg" alt=""><br>　　　　　　Appium inspector:<br>　　　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-1.jpeg" alt=""><br>　　　　　　　　例:选中一个控件,点击tap按钮,脚本框內自动生成脚本,模拟器自动根据动作进行操作.<br>　　　　终端使用:<br>　　　　　　终端使用需要另外安装一个appium client,按照用来编写脚本程序的语言不同安装对应,具体参照百度.<br>　　　　　　打开终端,输入<code>appium &amp;</code>即可启动<br>　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-2.png" alt=""><br>　　　　　　新建一个终端，进入脚本所在目录运行脚本<br>　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-3.png" alt=""><br>　　　　　　模拟器自动运行<br>　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-6.jpeg" alt=""><br><strong>3.第一个Python测试脚本,基本API解析</strong><br>　　　　<img src="http://oif61bzoy.bkt.clouddn.com/appium0-1-8.png" alt=""><br>　　　　注意点：测试方法必须以test开头或结尾</p>

      

      
    </div>
    <div class="article-info article-info-index">
      
      
	<div class="article-tag tagcloud">
		<i class="icon-price-tags"></i>
		<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Appium/">Appium</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/iOS/">iOS</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/unittest/">unittest</a></li></ul>
	</div>

      

      

      
        
<div class="share-btn share-icons tooltip-left">
  <div class="tooltip tooltip-east">
    <span class="tooltip-item">
      <a href="javascript:;" class="share-sns share-outer">
        <i class="icon icon-share"></i>
      </a>
    </span>
    <span class="tooltip-content">
      <div class="share-wrap">
        <div class="share-icons">
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="icon icon-weibo"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="icon icon-weixin"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="icon icon-qq"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="icon icon-douban"></i>
          </a>
          <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a>
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="icon icon-facebook"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="icon icon-twitter"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="icon icon-google"></i>
          </a>
        </div>
      </div>
    </span>
  </div>
</div>

<div class="page-modal wx-share js-wx-box">
    <a class="close js-modal-close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="http://s.jiathis.com/qrcode.php?url=http://yoursite.com/2016/12/20/Appium-Python iOS自动化测试从0-1/" alt="微信分享二维码">
    </div>
</div>

<div class="mask js-mask"></div>
      
      <div class="clearfix"></div>
    </div>
  </div>
</article>

  
<nav id="article-nav">
  
  
    <a href="/2016/12/20/unittest测试案例编写思路/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">unittest单元测试案例编写思路</div>
      <i class="icon-circle-right"></i>
    </a>
  
</nav>









          </div>
        </div>
      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info">
    	<div class="footer-left">
    		&copy; 2016 Sandsyu
    	</div>
      	<div class="footer-right">
      		<a href="http://hexo.io/" target="_blank">Hexo</a>  Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
      	</div>
    </div>
    <p class="copyright">本站总访问量 <span id="busuanzi_value_site_pv"></span> 次, 访客数 <span id="busuanzi_value_site_uv"></span> 人次, 本文总阅读量 <span id="busuanzi_value_page_pv"></span> 次</p>
  </div>
  <script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
</footer>
    </div>
    <script>
	var yiliaConfig = {
		mathjax: false,
		isHome: false,
		isPost: true,
		isArchive: false,
		isTag: false,
		isCategory: false,
		open_in_new: false,
		root: "/",
		innerArchive: true
	}
</script>

<script src="/./main.js?v=4.0.0.js"></script>


    
<div class="tools-col" q-class="show:isShow,hide:isShow|isFalse" q-on="click:stop(e)">
  <div class="tools-wrap">
    
    	<section class="tools-section tools-section-all" q-show="innerArchive">
        <div class="search-wrap">
          <input class="search-ipt" q-model="search" type="text" placeholder="find something…">
          <i class="icon-search icon" q-show="search|isEmptyStr"></i>
          <i class="icon-close icon" q-show="search|isNotEmptyStr" q-on="click:clearChose(e)"></i>
        </div>
        <div class="widget tagcloud search-tag">
          <p class="search-tag-wording">tag:</p>
          <label class="search-switch">
            <input type="checkbox" q-on="click:toggleTag(e)" q-attr="checked:showTags">
          </label>
          <ul class="article-tag-list" q-show="showTags">
             
              <li class="article-tag-list-item">
                <a href="javascript:void(0)">Appium</a>
              </li>
             
              <li class="article-tag-list-item">
                <a href="javascript:void(0)">unittest</a>
              </li>
             
              <li class="article-tag-list-item">
                <a href="javascript:void(0)">iOS</a>
              </li>
             
              <li class="article-tag-list-item">
                <a href="javascript:void(0)">测试</a>
              </li>
            
            <div class="clearfix"></div>
          </ul>
        </div>
        <ul class="search-ul">
          <p q-show="jsonFail" style="padding: 20px; font-size: 12px;">
            缺失模块。<br/>1、在博客根目录（注意不是yilia根目录）执行以下命令：<br/> npm i hexo-generator-json-content --save<br/><br/>
            2、在根目录_config.yml里添加配置：
<pre style="font-size: 12px;" q-show="jsonFail">
  jsonContent:
    meta: false
    pages: false
    posts:
      title: true
      date: true
      path: true
      text: true
      raw: false
      content: false
      slug: false
      updated: false
      comments: false
      link: false
      permalink: false
      excerpt: false
      categories: false
      tags: true
</pre>
          </p>
          <li class="search-li" q-repeat="items" q-show="isShow">
            <a q-attr="href:path|urlformat" class="search-title"><i class="icon-quo-left icon"></i><span q-text="title"></span></a>
            <p class="search-time">
              <i class="icon-calendar icon"></i>
              <span q-text="date|dateformat"></span>
            </p>
            <p class="search-tag">
              <i class="icon-price-tags icon"></i>
              <span q-repeat="tags" q-on="click:choseTag(e, name)" q-text="name|tagformat"></span>
            </p>
          </li>
        </ul>
    	</section>
    

    
    	<section class="tools-section tools-section-friends" q-show="friends">
  		
        <ul class="search-ul">
          
            <li class="search-li">
              <a href="http://github.com/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>github</a>
            </li>
          
            <li class="search-li">
              <a href="http://jianshu.com/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>简书</a>
            </li>
          
            <li class="search-li">
              <a href="http://stackoverflow.com/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>stackoverflow</a>
            </li>
          
            <li class="search-li">
              <a href="https://segmentfault.com/" target="_blank" class="search-title"><i class="icon-quo-left icon"></i>segmentfault</a>
            </li>
          
        </ul>
  		
    	</section>
    

    
    	<section class="tools-section tools-section-me" q-show="aboutme">
  	  	
  	  		<div class="aboutme-wrap" id="js-aboutme">&lt;span style = &quot;color:rgba(254, 65, 65, 0);&quot;&gt; 隐约雷鸣 阴霾天空&lt;br/&gt;但盼风雨来 能留你在此.&lt;/span&gt;</div>
  	  	
    	</section>
    
  </div>
  
</div>
    <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>
  </div>
</body>
</html>